﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class QUAN_Li_HANG_HOa : System.Web.UI.Page
{
    DBAccess db = new DBAccess();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack) return;
        loadGrid();
    }
    public void loadGrid()
    {
        db.con.Open();
        SqlDataAdapter da = new SqlDataAdapter("select * from LOAI_HANG", db.con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
    protected void lbtn_Click(object sender, EventArgs e)
    {
        LinkButton a = (LinkButton)sender;
        string aa = a.CommandName;
        db.con.Open();
        SqlCommand com = new SqlCommand("delete from LOAI_HANG where ID_LOAI_HANG="+aa+"", db.con);
        com.ExecuteNonQuery();
    }
}